package com.dynamic.model.model.po;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.dynamic.model.common.entity.BaseEntity;
import org.hibernate.annotations.Where;


/**
 * 
 * @desc 用户后台登陆用户角色表--RBAC权限管理实体
 *
 * @author luwei
 * @Fri Aug 08 14:27:52 CST 2014
 */
@Entity
@Table(name="SYSMAN_ROLE")
public class SysmanRole extends BaseEntity {
	
	/**
	 * 角色名
	 */
	@Column(nullable =false,length=50)
	private String name;
	/**
	 * 角色描述
	 */
	@Column(length=200)
	private String description;
	/**
	 * 0 : 系统(不可见)  1 :用户级(可见)
	 */
	private Integer roleType;
	/**
	 * 拥有权限
	 *
	 */
	@ManyToMany(cascade = CascadeType.MERGE)
	@JoinTable(name="SYSMAN_ROLE_RESOURCE",joinColumns ={@JoinColumn(name="role_id")},inverseJoinColumns={@JoinColumn(name="resource_id")})
	@Where(clause="delete_flag=0")
	private List<SysmanResource> resource;  
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<SysmanResource> getResource() {
		return resource;
	}

	public void setResource(List<SysmanResource> resource) {
		this.resource = resource;
	}

	public Integer getRoleType() {
		return roleType;
	}

	public void setRoleType(Integer roleType) {
		this.roleType = roleType;
	}


	
}